export const throwError = () => {
    throw new Error(`Error in ${__filename}: ` + error)
}

export const dataMaybeError = async (data, res) => {
    const data = await res.json()

    if (!res.ok) {
        throw new Error(data.error || "Something went wrong")
    }

    return data
}